package com.tsystems.train.dao;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

public abstract class AbstractDAO<T > {
	@PersistenceContext(unitName="train")
	private EntityManager em;
	
	protected EntityManager getEntityManager() {
		return em;
	}
	
	public void insert(T entity) {
		em.persist(entity);;
	}
	
	public void remove(T entity) {
		em.remove(entity);
	}
	
	
	public void update(T entity) {
		em.merge(entity);
	}
}
